﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLK.Database.DALs;

namespace QLK.Database.BLLs
{
    public class Invoices_ProductBLL
    {
        private Invoices_ProductDAL dal;

        public Invoices_ProductBLL()
        {
            dal = new Invoices_ProductDAL();
        }

        public List<Invoices_Product> Invoices_ProductGetALL()
        {
            return dal.Invoices_ProductGetALL();
        }

        public Invoices_Product Invoices_ProductGetByID(int InvoiceID, bool type)
        {
            if (dal.Invoices_ProductCheckDuplicateInvoiceID(InvoiceID, type))
            {
                return null;
            }
            else
            {
                return dal.Invoices_ProductGetByID(InvoiceID, type);
            }
        }

        public bool Invoices_ProductInsert(Invoices_Product InvoicePro)
        {
            if (dal.Invoices_ProductCheckDuplicateInvoiceID(InvoicePro.InvoiceID, InvoicePro.Type))
            {
                return dal.Invoices_ProductInsert(InvoicePro);
            }
            else
                return false;
        }

        public bool Invoices_ProductDeleteByID(int InvoiceID, bool type)
        {
            return dal.Invoices_ProductDeleteByID(InvoiceID, type);
        }

        public bool Invoices_ProductUpdate(Invoices_Product InvoicePro)
        {
            return dal.Invoices_ProductUpdate(InvoicePro);
        }

        public bool Invoices_ProductDeleteProduct(int InvoiceID, bool type, int ProID)
        {
            return dal.Invoices_ProductDeleteProduct(InvoiceID, type, ProID);
        }

        public ImportInvoice GetImportInvoiceByImportID(int importID)
        {
            return dal.GetImportInvoiceByImportID(importID);
        }

        public void DeleteImportInvoiceByImportID(ImportInvoice Import)
        {
            dal.DeleteImportInvoiceByImportID(Import);
        }

        public IEnumerable<ImportInvoice> GetImportInvoiceAdvanced(string invoiceName, string storeName, string supplierName, string employeeName)
        {
            return GetImportInvoiceAdvanced(invoiceName, storeName, supplierName, employeeName);
        }
    }
}
